package com.example.test.springbootdemo.respository.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate4.support.HibernateDaoSupport;
import org.springframework.stereotype.Component;

import com.example.test.springbootdemo.entity.Products;
import com.example.test.springbootdemo.respository.ProductsRepository;

@Component("productsRepository")
public class ProductsRepositoryImpl extends HibernateDaoSupport implements ProductsRepository {

	
	public ProductsRepositoryImpl() {
		System.out.println("ProductsRepositoryImpl初始化");
	}
	
	@Autowired
	SessionFactory sessionFactory;
	
	@Override
	public List<Products> findAll() {
		
		List<Products> plist = (List<Products>) this.getHibernateTemplate().find("from Products", null);
		return plist;
	}

	@Override
	public void removeObject() {
		// TODO Auto-generated method stub

	}

}
